package engine;

import java.util.ArrayList;
import java.util.List;

/**
 * Class to define cities
 * @author Joshua Chang
 */
public class City {
    private String name;
    private boolean hasResearchStation;
    private int[] dzCubes;
    private DColor color;
    private List<City> connectedCities;    
    
    public City(String name, DColor color) {
        this.name = name;
        this.hasResearchStation = false;
        this.dzCubes = new int[4];
        for (int i = 0; i < 4; i++)
            this.dzCubes[i] = 0;
        this.connectedCities = new ArrayList<>();
        this.color = color;
    }        
    
    public void setHasResearchStation(boolean hasResearchStation) {
        this.hasResearchStation = hasResearchStation;
    }

    public String getName() {
        return name;
    }
    
    public DColor getColor() {
        return color;
    }
    
    public boolean getHasResearchStation() {
        return hasResearchStation;
    }
    
    public int[] dzCubes() {
        return dzCubes;
    }
    
    public List<City> getConnectedCities() {
        return connectedCities;
    }
    
    public void addConnectedCity(City city) {
        this.connectedCities.add(city);
    }
    
    public void addDzCube(DColor color) {
        this.dzCubes[color.index()]++;
    }
    
    public void removeDzCube(DColor color) {
        this.dzCubes[color.index()]--;
    }

    public void removeAllDzCubes(DColor color) {
        this.dzCubes[color.index()] = 0;
    }

    public int getDzCubes(DColor color) {
        return this.dzCubes[color.index()];
    }
}
